#!/usr/bin/env python

##########################################################################
# File Name: common_handlers.py
# Author: baohua
# Mail: liubaohuachina@163.com
# Create Time: 2020/03/24 09:22:34
# Version: 1.0
# Description: 
##########################################################################

import asyncio

from sitebase.base import BaseHandler
from sitebase.models import Person


class ConsulHealthHandler(BaseHandler):
    async def get(self):
        self.write("hello world")


class CookiehHandler(BaseHandler):
    async def get(self):
        """ 生成cookie后，必须要设置reids中的值
            setex token-0ed373e8bbfd4acf886ea9851c7f65b0 86400 1
        """
        # self.set_secure_cookie('user', '{"n": "jichujiaoyuchu", "g": "2508", "t": "2", "o": "113", "r": "0", "i": "40e69fdf324b4800b17a8fe1aef72e86", "h": "dcab98274909a25408300d9bda863056", "s": 0}', expires_days=3600)
        
        # 薄存旭 setex token-f4414922e61d4b75aed0bd359d6d5301 86400 1
        # self.set_secure_cookie('user', '{"n": "371321198011126338 ", "g": "0", "t": "0", "o": "0", "r": "0", "i": "f4414922e61d4b75aed0bd359d6d5301", "h": "dcab98274909a25408300d9bda863056", "s": 0}', expires_days=3600)
        
        # 宗锦莲 setex token-0db997bd1b224aa197eb6630bccbd47e 86400 1
        # self.set_secure_cookie('user', '{"n": "320481198307082428 ", "g": "0", "t": "0", "o": "0", "r": "0", "i": "0db997bd1b224aa197eb6630bccbd47e", "h": "dcab98274909a25408300d9bda863056", "s": 0}', expires_days=3600)
        
        # 沈佳乐 setex token-6f1ba406a7604f5f94aa6cce872a46a0 86400 1
        # self.set_secure_cookie('user', '{"n": "330501198101061328 ", "g": "0", "t": "0", "o": "0", "r": "0", "i": "6f1ba406a7604f5f94aa6cce872a46a0", "h": "dcab98274909a25408300d9bda863056", "s": 0}', expires_days=3600)

        self.set_secure_cookie('user', '{"n": "32128419890323022X", "g": "0", "t": "8", "o": "67", "r": "8", "i": "0ed373e8bbfd4acf886ea9851c7f65b0", "h": "01b3548d171ac59621897de97220b104", "s": 0}', expires_days=3600)
        
        
        self.write("OK")
